﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace YXShop.Web.product
{
    public partial class productcontent : System.Web.UI.Page
    {
        YXShop.BLL.Product.ScanInfo scanBll = new YXShop.BLL.Product.ScanInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string productid = ChangeHope.WebPage.PageRequest.GetQueryString("q_productid");
                if (productid != "")
                {
                    YXShop.Common.CookieUtil.AddHistoryCookie(productid);
                    if (Session["MemberID"] != null)
                    {
                        YXShop.Model.Product.ScanInfo model = new YXShop.Model.Product.ScanInfo();
                        model.ProductId = Convert.ToInt32(productid);
                        model.Uid = Convert.ToInt32(Session["MemberID"]);
                        model.ScanTime = Convert.ToDateTime(System.DateTime.Now);
                        scanBll.Add(model);
                    }
                    YXShop.BLL.Product.ProductInfo proBll = new YXShop.BLL.Product.ProductInfo();
                    DataTable dt = proBll.GetAppointField("pro_ContentTemplate", " and pro_ID=" + productid);
                    if (dt.Rows.Count > 0)
                    {
                        string template = dt.Rows[0]["pro_ContentTemplate"].ToString().Trim();
                        if (!string.IsNullOrEmpty(template))
                        {
                            Response.Write(YXShop.TemplateAction.Common.YXShop_PageContent2(template));
                        }
                        else
                        {
                            Response.Write(YXShop.TemplateAction.Common.YXShop_PageContent("productcontent"));
                        }
                    }
                }
                else
                {
                    Response.Write(YXShop.TemplateAction.Common.YXShop_PageContent("productcontent"));
                }
            }
        }
    }
}
